package kr.pfg.socialproject.utils
{
	public class URIUtil
	{
		static public function mergeParameterToURI( uri: String, parameter: Object ): String
		{
			var result: String;
			
			var splitted: Array = uri.split( "?" );
			result = splitted[ 0 ];
			
			var param: String = splitted.length > 1 ? splitted[ 1 ] + "&" : "";
			
			var prop: String;
			for( prop in parameter )
			{
				param += prop + "=" + parameter[ prop ] + "&";
			}
			
			if( param.charAt( param.length - 1 ) == "&" )
				param = param.slice( 0, -1 );
			
			if( param.length > 0 )
				result += "?" + param;
			
			return result;
		}
	}
}